package com.cinyi.ormlite.core;

import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

/**
 * 表配置对象
 * @author penghui
 *
 */
public class TableConfig implements Serializable{
    /**
     * 
     */
    private static final long serialVersionUID = -581104432455373334L;
    
    private String tableName ;
    private Field[] fields ;
    private String idProperty ;
    private String idColumnName ;
    private List<Field> one2many = new ArrayList<Field>();
    
    private boolean crazyload = false ;
    
    public TableConfig(String name)
    {
        this.tableName = name ;
    }

    public String getTableName()
    {
        return tableName;
    }

    public void setTableName(String tableName)
    {
        this.tableName = tableName;
    }

    public Field[] getFields()
    {
        return fields;
    }

    public void setFields(Field[] fields)
    {
        this.fields = fields;
    }

    public String getIdProperty()
    {
        return idProperty;
    }

    public void setIdProperty(String idProperty)
    {
        this.idProperty = idProperty;
    }

    public String getIdColumnName()
    {
        return idColumnName;
    }

    public void setIdColumnName(String idColumnName)
    {
        this.idColumnName = idColumnName;
    }

    public boolean isPrimaryKey(String field){
        return field.equalsIgnoreCase(idProperty);
    }

    public List<Field> getOne2many()
    {
        return one2many;
    }

    public void setOne2many(List<Field> one2many)
    {
        this.one2many = one2many;
    }

	public boolean isCrazyload() {
		return crazyload;
	}

	public void setCrazyload(boolean crazyload) {
		this.crazyload = crazyload;
	}

}
